#include <ximera/audio/openal/plugin.hpp>
#include <ximera/audio/openal/audiosystem.hpp>

namespace ximera { namespace audio { namespace openal
{
    Plugin* Plugin::_instance = NULL;

    system::IPlugin* Plugin::getInstance()
    {
        if (!_instance)
        {
            _instance = new Plugin();
        }

        return _instance;
    }

    Plugin::Plugin() : _name(L"XimeraOpenAL"), _description(L"OpenAL plugin for Ximera Engine"),
        _version(L"0.1")
    {
    }

    Plugin::~Plugin()
    {
        _instance = NULL;
    }

    String Plugin::name() const
    {
        return _name;
    }

    String Plugin::description() const
    {
        return _description;
    }

    String Plugin::version() const
    {
        return _version;
    }

    system::ISystem* Plugin::createSystem(system::Application& app)
    {
        return new AudioSystem();
    }

    extern "C" XIMERA_PLUGIN_API system::IPlugin* ximera_initPlugin(void)
    {
        return Plugin::getInstance();
    }
}}}
